<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>换肤2</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    body {
        /* display: flex; */
        background: url(./img/1.png) no-repeat;
        background-size: 100% 100vh;
        text-align: center;
    }

    /* img{
        background: url(./img/1.png) no-repeat;
    } */
    #box {
        width: 100%;
        height: 250px;
        background: rgba(000, 000, 000, 0.2);
        position: absolute;
        top: 0;
        left: 0;
        margin: auto;
    }

    #box img {
        width: 200px;
        height: 200px;
        margin-top: 25px;
    }
</style>
<body>
    <div id="box">
        <img src="./img/1.png" alt="">
        <img src="./img/2.png" alt=""> 
        <img src="./img/3.jpg" alt="">
        <img src="./img/4.jpg" alt="">
        <img src="./img/5.jpg" alt="">
    </div>
</body>
<script>
    var imgs = document.querySelector('#box').querySelectorAll('img')
        for (var i = 0; i < imgs.length; i++) {
            imgs[i].onclick = function () {
                document.body.style.backgroundImage = 'url(' + this.src + ')';
            }
    }
</script>
</html>